﻿using MediatR;
using T.Vehicleservice.API.Application.Command.AccidentRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.AccidentRecordHandler
{
    public class AccidentRecordUpdCommandHandler : IRequestHandler<AccidentRecordUpdCommand, int>
    {
        private readonly IAccidentRecordRepository _repository;
        public AccidentRecordUpdCommandHandler(IAccidentRecordRepository repository)
        {
            _repository = repository;
        }

        public async Task<int> Handle(AccidentRecordUpdCommand request, CancellationToken cancellationToken)
        {
            return await _repository.UpdateAsync(request);
        }
    }
}
